package com.echo.center.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.echo.center.business.entity.SysUser;
import com.echo.center.config.context.LoginUser;

/**
 * @author chentl
 * @version V1.0
 * @Project SysUserService
 * @Title SysUserService.java
 * @Description 用户服务层
 * @Package com.echo.auth.business.service
 * @date 2019/10/30 13:26
 * @Copyright: 上海顺益信息科技有限公司 All rights reserved.
 */
public interface SysUserService extends IService<SysUser> {

    /**
     * 登录 (成功后返回token)
     *
     * @param username
     * @param password
     * @return
     */
    String login(String username, String password);


    /**
     * 检查token 是否正确
     *
     * @param token
     * @return
     */
    boolean checkToken(String token);

    /**
     * 登出
     *
     * @param token
     */
    void logout(String token);

    /**
     * 拿token 取用户
     *
     * @param token
     * @return
     */
    LoginUser getLoginUserByToken(String token);

    /**
     * 根据用户名获取用户
     *
     * @param username
     * @return
     */
    SysUser getUserByName(String username);
}
